<?php echo '<?xml version="1.0" encoding="UTF-8"?>' ?>

<books xmlns="http://leganto.com/api">
		
	{foreach $books AS $book}
	<book>

		<id>{$book->getId()}</id>
	
		<title>{$book->title}</title>
	
		{if !empty($book->subtitle)}
		<subtitle>{$book->subtitle}</subtitle>
		{/if}
	
		<authors>
			{foreach $authors[$book->getId()] AS $author}
			<author>
				<id>{$author->getId()}</id>
				<type>{$author->type}</type>
				{if !empty($author->groupname)}
				<groupname>{$author->groupname}</groupname>
				{/if}
				{if !empty($author->firstname)}
				<firstname>{$author->firstname}</firstname>
				{/if}
				{if !empty($author->lastname)}
				<lastname>{$author->lastname}</lastname>
				{/if}
			</author>
			{/foreach}
		</authors>
	
		<rating>{$book->rating}</rating>
	
		<number-of-opinions>{$book->numberOfOpinions}</number-of-opinions>
		
	</book>
	{/foreach}

</books>